import numpy as np


def entropy(x, y):
    c = x + y
    a = x / c
    b = y / c
    return -(a * np.log(a) + b * np.log(b))


a = entropy(18, 22)
b = entropy(17, 3)
c = entropy(1, 19)
r = a - (0.5 * b + 0.5 * c)
print(r)
